<?php
  require_once('tpl/header.php');
?>

<?php 
connect();
$sqlc="select * from comments";
$resultc=mysql_query($sqlc);
?>
<table class="table table-striped">
	<tr>
		<th>编号</th>
		<th>视频名称</th>
		<th>留言内容</th>
		<th>留言时间</th>
		<th>留言人</th>
		<th>操作</th>
	</tr>
	<?php 
	while ($rowc=mysql_fetch_assoc($resultc)) {
                        # code...
		?>
		<tr>
			<td><?php echo $rowc["cid"]; ?></td>
			<td><?php 
				$vid=$rowc["vid"];
				$sqlid="select videoname from videos where vid=$vid";
				$resultid=mysql_query($sqlid);
				$rowid1=mysql_fetch_assoc($resultid);
				echo $rowid1["videoname"];
			 ?></td>
			<td><?php echo $rowc["content"]; ?></td>
			<td><?php echo $rowc["cdate"]; ?></td>
			<td><?php 
			$uid=$rowc["uid"];
			$sqluname="select uname from users where uid=$uid";
			$resultuname=mysql_query($sqluname);
			$rowuname=mysql_fetch_assoc($resultuname);
			echo $rowuname["uname"]; 
			?></td>
			<td><a href="doCommentDelete.php?cid=<?php echo $rowc['cid']; ?>" onclick="return confirm('你真的要删除我么？')">删除</a></td>
		</tr>
		<?php
	}
	?>
</table>



<?php
  require_once('tpl/footer.php');
?>